package com.shujia.common

import java.io.InputStream
import java.util.Properties

object Config {

  //1、加载resources目录的配置文件
  val inputStream: InputStream = this.getClass //获取类对象
    .getClassLoader //获取类加载器
    .getResourceAsStream("config.properties") //从resources获取一个输入流


  //2、加载配置
  val properties = new Properties()
  properties.load(inputStream)


  //通过key获取value
  def getConfig(key: String): String = {
    properties.getProperty(key)
  }
}
